/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once

#include "场景/场景.h"
#include "物体/物体.h"
#include "UI/布局.h"
#include "UI/Widget.h"
#include "UI/ui绘制模板.h"

#include <atomic>
#include <mutex>



class C_3D视口 : public C_Widget {
	std::thread m_线程;

	S_GPU计算* m_后期计算准备;
	S_GPU计算* m_后期深度混合;
	S_GPU计算* m_后期SMAA;
	S_GPU计算* m_后期FXAA;
	S_GPU计算* m_后期TAA;
	S_GPU计算* m_后期焦点描边;

	S_GPU参数槽 m_后期准备;
	S_GPU参数槽 m_参数布局;
	S_GPU参数槽 m_抗锯齿参数布局;

	S_GPU计算* m_后期预览调试;
	S_GPU参数槽 m_描边_参数布局;

	

public:
	C_3D视口(S_UI渲染环境& ctx, S_设备环境& Ctx3D);
	~C_3D视口();

	S_设备环境		m_Ctx3D;
	S_Scene*		m_Scene;

	std::vector<S_Surface3D*> m_渲染层;
	

	S_Surface2D* m_纹理绘制;
	S_Surface2D* m_背景;
	S_Surface2D* m_背景2;

	uint32 m_颜色纹理ID;
	uint32 m_轮廓纹理ID;
	


	S_纹理* m_深度纹理;
	S_纹理* m_速度纹理;
	S_纹理* m_历史纹理;
	S_纹理* m_法线纹理;
	S_纹理* m_坐标纹理;


	std::mutex			m_锁;
	

	S_摄像机*			_m_默认镜头;
	S_摄像机*			m_镜头;
	uint32				m_采样ID;
	//uint64				m_视口ID;

	S_渲染回调			m_绘制回调;

	std::atomic_bool	m_正在渲染;
	std::atomic_bool	m_退出渲染;
	
	
	E_视口渲染调试层	m_调试层;
	bool                m_使用全局采样参数;

	S_3D视口属性		m_绘制属性;
	GLSL_RenderFrame	m_帧渲染参数;



	bool f_渲染();




	//废弃
	fp_Widget更新		mf_场景外部更新回调;
	E_物体渲染模式		m_渲染模式;
};







